For many types of persistent storage devices, such as NAND flash memories or phase-change memories (PCMB), data writing or reading is performed in access units. That is, unlike a random access memory into which data can be written bit-by-bit, there is a minimum size for the access units of such a persistent storage device. The access unit may be, for example, a NAND page having a size of, e.g., 2 kB, 4 kB, or 8 kB, a main memory page having a size of, e.g., 4 kB, or a storage block having a size of, e.g., 512 B. In such a persistent storage device, a write operation needs to be performed for an entire access unit, e.g., page or block, at the same time, and thus a small piece of data that is smaller than the size of the access unit usually cannot be individually written to the persistent storage device.
In many applications, the persistent storage device is used together with a temporary storage device (also referred to as a fast device, which may include, for example, a random-access memory (RAM), such as a static random-access memory (SRAM), a dynamic random-access memory (DRAM), a phase-change memory (PCM), or a resistive random-access memory (RRAM)). Data stored on the persistent storage device may be read to the temporary storage device, and then processed in the temporary storage device. During the process, a portion of the data read into the temporary storage device may be modified, and the modified portion may then need to be written back into the persistent storage device to update the data stored in the persistent storage device. In such a scenario, a read-modify-write process needs to be performed, as described below in detail.
As shown in FIG. 1A, data sequence 102 is saved on a persistent storage device. The data sequence 102 includes a plurality of data segments, each of which has a size equal to the size of the access unit of the persistent storage device. For example, one of the data segments, i.e., a data segment 104 in FIG. 1A, includes three data entries 104-1, 104-2, and 104-3. Further, the data segment 104 is read into the temporary storage device and during the process in the temporary storage device, the data entry 104-2 is modified and the modified data entry (also referred to as a “dirty data entry”) is noted as 104-2′ in FIG, 1A. The modified data entry 104-2′ now needs to be written back to the persistent storage device to update the data entry 104-2 stored therein. As shown in FIG. 1B, the data entries 104-1 and 104-3 are read from the persistent storage device to the temporary storage device. An entire data segment 104′ that consists of the data entries 104-1, 104-2′, and 104-3 is then written back to the persistent storage device, as shown in FIG. 1C.
Thus, in such a read-modify-write process described above, an additional read step is performed when a piece of data needs to be written back to the persistent storage device. Therefore, the performance of the entire system is degraded.